package com.atguigu.dga.governance.assess.impl.spec;

import com.atguigu.dga.governance.assess.Assessor;
import com.atguigu.dga.governance.bean.AssessParam;
import com.atguigu.dga.governance.bean.GovernanceAssessDetail;
import com.atguigu.dga.meta.bean.TableMetaInfo;
import com.atguigu.dga.meta.bean.TableMetaInfoExtra;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

@Component("TEC_OWNER")
public class TecOwnerAssessor extends Assessor {

    @Override
    protected void assess(AssessParam assessParam, GovernanceAssessDetail governanceAssessDetail) {

        TableMetaInfo tableMetaInfo = assessParam.getTableMetaInfo();
        TableMetaInfoExtra tableMetaInfoExtra = tableMetaInfo.getTableMetaInfoExtra();

        //判断是否有技术负责人
        if (tableMetaInfoExtra.getTecOwnerUserName()==null||tableMetaInfoExtra.getTecOwnerUserName().length()<=0){
            //证明没有技术负责人
            governanceAssessDetail.setAssessScore(BigDecimal.ZERO);
            governanceAssessDetail.setAssessProblem("没有技术负责人");
            String url = assessParam.getGovernanceMetric().getGovernanceUrl() + tableMetaInfo.getId();
            governanceAssessDetail.setGovernanceUrl(url);
        }

    }
}
